UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YZwR5XdXaRQaTf1p5BzwtJeqfv0NOs5yybNwRoh07gs=' 
WHERE 
  key_id = '5dad2c742acbd36322f5e0c9b6172a4d40d778000419a4e0a721113614ad7a3e' 
  AND (
    token = 'YZwR5XdXaRQaTf1p5BzwtJeqfv0NOs5yybNwRoh07gs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027