UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'g2FfxG0mE3ZCbC07fcHDBgrSsOhQQskCq8cIui2GnDM=' 
WHERE 
  key_id = '30eef2112bb56a1565aa6cc1b51217b6be27d82d0378635f501b5cbce2aa139f' 
  AND (
    token = 'g2FfxG0mE3ZCbC07fcHDBgrSsOhQQskCq8cIui2GnDM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045