UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '2XQMX4AJJ2o6nfiVmoxwX5UkHmfR/zQKOsScDb36Wa0=' 
WHERE 
  key_id = 'be34cab753540c8d346b7591cf7b70017163956e2ae592dd35622017bd3dbed6' 
  AND (
    token = '2XQMX4AJJ2o6nfiVmoxwX5UkHmfR/zQKOsScDb36Wa0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033