UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '3Bji/jdMBSM3Oaa3BMK4ltpfb/b8Wij6qZp+o5ncNh8=' 
WHERE 
  key_id = 'ee2618f988a44ced58a998ba5604cbb71728d6161a126ddb0e9aeeb90da48393' 
  AND (
    token = '3Bji/jdMBSM3Oaa3BMK4ltpfb/b8Wij6qZp+o5ncNh8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030