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

Query time 0.00036