UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'n5wSWFvULr/ZOUKxn1KAZoy8btuyjiuzk9KSHYkrmoM=' 
WHERE 
  key_id = '1432031685ee235a1c3302106890f86f7ccd148e14546032c1ca89b2a82d2a37' 
  AND (
    token = 'n5wSWFvULr/ZOUKxn1KAZoy8btuyjiuzk9KSHYkrmoM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032