UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XgbqM8wsvSSDhp8gM70bR5eGQ6vWfHJULrHGVE5X+Oo=' 
WHERE 
  key_id = '2a3df1f338c1c879c503eeeac4d86700fb378af67731e8960e95ee8995d7efd1' 
  AND (
    token = 'XgbqM8wsvSSDhp8gM70bR5eGQ6vWfHJULrHGVE5X+Oo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027