UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'PR0yT4x5COEM8MbrvxHX2AX/mPLw8ZI30Fyqr/klDW8=' 
WHERE 
  key_id = '5f963b451eb079e63b35d639a9ff539066a2ae0d913d9b48d3d79c9a8fb53b0c' 
  AND (
    token = 'PR0yT4x5COEM8MbrvxHX2AX/mPLw8ZI30Fyqr/klDW8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030