UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '0GHhjPQ4oQbDvHXQlo0PbVQNylvzFRr64JaoVAyJjvk=' 
WHERE 
  key_id = 'f30df263cc31760e77c61c4be4cf0427fc3c43daa6629a959ccb9755a3f6e2d2' 
  AND (
    token = '0GHhjPQ4oQbDvHXQlo0PbVQNylvzFRr64JaoVAyJjvk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026