UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'TIF1s0DF/1avZ59QrSgK1mjPJ4nK63dDVMshLuj5GWc=' 
WHERE 
  key_id = '7e39a0188897097b3f55b9691f073d7d743579f2e4c526c5366cac36edfb6b4d' 
  AND (
    token = 'TIF1s0DF/1avZ59QrSgK1mjPJ4nK63dDVMshLuj5GWc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037