UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '8MEu+aya2N7948HfjS1l3GWf0GpXn4Ckdkz5dYEsfh4=' 
WHERE 
  key_id = '7d91403ecb045bc269f80ade8de150618058168705c04c8a6584f1023ebf88c6' 
  AND (
    token = '8MEu+aya2N7948HfjS1l3GWf0GpXn4Ckdkz5dYEsfh4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033