UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '83To3jz6FhMSwJtwxtnLgwO4i+RZS4YMdW0rMYf8WFk=' 
WHERE 
  key_id = '71eccb105074e833eb64907d3dbfb880b4bb28a97adc325e4d717deeb19303e8' 
  AND (
    token = '83To3jz6FhMSwJtwxtnLgwO4i+RZS4YMdW0rMYf8WFk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026