UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'yezI8Z4fRBWD3hxLa6/+VJCqeYyFg0jnd1CvoKqAqag=' 
WHERE 
  key_id = '7bed329484d5df4c5e0ef23907b93f270a9f75232f770398c72e9ef6803517e7' 
  AND (
    token = 'yezI8Z4fRBWD3hxLa6/+VJCqeYyFg0jnd1CvoKqAqag=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00051