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

Query time 0.00057