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

Query time 0.00037