UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'vIbf+nbwMGnHknqTU0q5wrS5PTxOlVLgi0K7Ai2XkkM=' 
WHERE 
  key_id = 'b25d94b4cc0c379799f7b4d304f6a85cb0abe9b2b52690e1d1a04681ec705337' 
  AND (
    token = 'vIbf+nbwMGnHknqTU0q5wrS5PTxOlVLgi0K7Ai2XkkM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044