UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'AUbPKILOpvQxi56MtFUyIU4TrSQwmx0kOI8xwFFI3Xs=' 
WHERE 
  key_id = 'ad8aeae455056af90556145dbc28d76de421a14d3c94f53fe326a3c19ab0821e' 
  AND (
    token = 'AUbPKILOpvQxi56MtFUyIU4TrSQwmx0kOI8xwFFI3Xs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038