UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'myUt2RyLYi3qniFBtts74Q8sv1D8b/9sCT7MU7w2zVA=' 
WHERE 
  key_id = '76ce079f93766888ed9fc1d2ec206eb330e000c7fee7b7038936fbf106fc87c8' 
  AND (
    token = 'myUt2RyLYi3qniFBtts74Q8sv1D8b/9sCT7MU7w2zVA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00053