UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'yifTEAFHbKgdpQLPz2JGChcyZZjKQ36ZmO1chPhmEHc=' 
WHERE 
  key_id = '24e551eb0f8a4efca797d11be092567ef665b9b01f3e4ac89dbe24a3ee17b904' 
  AND (
    token = 'yifTEAFHbKgdpQLPz2JGChcyZZjKQ36ZmO1chPhmEHc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036