UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'wiZJ5hsmLADytnrASgtJsVgesUvjf9u/0oTzTaNOfKg=' 
WHERE 
  key_id = '498b660078e89fca79a165c88fa1f2783c62168825cce5ef1a5296c9daadc8e5' 
  AND (
    token = 'wiZJ5hsmLADytnrASgtJsVgesUvjf9u/0oTzTaNOfKg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046