UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'irbpCZnfRwsPCV3PojyTAwv4F/Cr0yz1EJKR0D/tzdY=' 
WHERE 
  key_id = '8c304b0c418b90723c8f9e755a31069867082894afe97892f1d2983a3b0c6593' 
  AND (
    token = 'irbpCZnfRwsPCV3PojyTAwv4F/Cr0yz1EJKR0D/tzdY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023