UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YamehZBhVKzjcfBeKh7YhgfhVqy0UZzZ3sbHb9GGQeA=' 
WHERE 
  key_id = '1130c297c3f03da9f9b1c86e08767719d157bc96547ed7721bc7705fb8b318b2' 
  AND (
    token = 'YamehZBhVKzjcfBeKh7YhgfhVqy0UZzZ3sbHb9GGQeA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044