UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'as9F8pyyh3i8Lv8meJUTQRcCBjwGTo3jbGnmrRPhlSU=' 
WHERE 
  key_id = '494317476781ad1511c791cc0e735828eace6f1154af2af3fde35e8b73ecf699' 
  AND (
    token = 'as9F8pyyh3i8Lv8meJUTQRcCBjwGTo3jbGnmrRPhlSU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00051