UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '1aZ37jLbddTdWf/UJkcf2+omUhtGLqXn6+aSyTIk5fo=' 
WHERE 
  key_id = '86499029d221507f1e3883edd5f769029131dbd762f29e1946e140263f92e65d' 
  AND (
    token = '1aZ37jLbddTdWf/UJkcf2+omUhtGLqXn6+aSyTIk5fo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039