UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '9kcIBHoP0yP67arm0xx0S2XstPTAHpOMutNnxsQ2pzI=' 
WHERE 
  key_id = 'c9bc9af5e1cdb4fa83c95b3d8c6e0d28f7ca8467208f8085f15a8ff48203a58f' 
  AND (
    token = '9kcIBHoP0yP67arm0xx0S2XstPTAHpOMutNnxsQ2pzI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00055