UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'rTxvfLZg+M093THAw8uYFjSp1huXz6bF60wK6tFvNcY=' 
WHERE 
  key_id = '4b2134265b24a2a627d08c5e8c30f0199e87b5d7f22a2630b3f1f8e8d1d0c86c' 
  AND (
    token = 'rTxvfLZg+M093THAw8uYFjSp1huXz6bF60wK6tFvNcY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029