UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'zM2OidqTo+SMWjg4HUGJ4XlwTqHBa/bs2tWccMivnQc=' 
WHERE 
  key_id = 'ec5f5dfb6887b3c350d0cef0be1900882d9e25b23851e354a8d9de1e42cd753d' 
  AND (
    token = 'zM2OidqTo+SMWjg4HUGJ4XlwTqHBa/bs2tWccMivnQc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032