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

Query time 0.00027