UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BJ/K5GSWoIHZKcMp3TzBXyHTYUCZN7MGxgyJ12Sobk8=' 
WHERE 
  key_id = '841e5e606f478556ae6aaa5ac781b6c57994991cfc4db6c49c91a1b2cb34662e' 
  AND (
    token = 'BJ/K5GSWoIHZKcMp3TzBXyHTYUCZN7MGxgyJ12Sobk8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028