UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KvEEysmLKWPN2zjoft6ZTCaQDozgrNBtMk2bjiCrfPc=' 
WHERE 
  key_id = '74bd7f2385a07453e87526dd64ecfc8472570d729eca519934786cd50108479f' 
  AND (
    token = 'KvEEysmLKWPN2zjoft6ZTCaQDozgrNBtMk2bjiCrfPc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036