UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '4G1L0bNja+wqQ5XOERRzZd43ZRJGqUBnTDCud91tIBo=' 
WHERE 
  key_id = '950af97e3f6d519e8f173eb00935ac8cfdd4b7ebde01ff978752888896333bf7' 
  AND (
    token = '4G1L0bNja+wqQ5XOERRzZd43ZRJGqUBnTDCud91tIBo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026