UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'T94XXwJzLHhLFDMOZ99/SA3DV3Lv4lGaqYBzEA+a8MA=' 
WHERE 
  key_id = '1dfe48054e44cfdd774fb41bc2c89b3dfda4bece18a4050cb209439e06b59419' 
  AND (
    token = 'T94XXwJzLHhLFDMOZ99/SA3DV3Lv4lGaqYBzEA+a8MA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00052