UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'rL5FAEMhF/BrG4iGbXT9gp1Le5m/vtwpAhhRO1NeibY=' 
WHERE 
  key_id = '6e8d5f2fc243e2bb4c817c7bc0bd2cd1f73198c05befe764123cda9f9b577b67' 
  AND (
    token = 'rL5FAEMhF/BrG4iGbXT9gp1Le5m/vtwpAhhRO1NeibY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037