UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'z5Ggjn4OfrHJLPQCYBDR7hcdixVpwSHav6um4TsypUg=' 
WHERE 
  key_id = 'e95bae40e60285b1c74ddef8c391b94d210e95006faaab4a6697d2b31520791b' 
  AND (
    token = 'z5Ggjn4OfrHJLPQCYBDR7hcdixVpwSHav6um4TsypUg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032