UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ZD0aCONPsZtr9dAB4WfoZU7shq21VMVf2f/gifz4ffc=' 
WHERE 
  key_id = '7262bcb2fde30997d5c71a190f501dc51b45744aaede6db8a0b67e4fac2fccd8' 
  AND (
    token = 'ZD0aCONPsZtr9dAB4WfoZU7shq21VMVf2f/gifz4ffc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038